package com.mxpio.erp.common.equipment.entity;

import com.mxpio.erp.common.jpa.model.Notice;
import com.mxpio.erp.common.jpa.model.NoticeLine;
import com.mxpio.erp.common.vo.OrderExcuteLineVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_UPKEEP_PICKUP_NOTICE")
@Schema(description="保养领料通知单")
public class UpkeepPickupNotice extends Notice {

	private static final long serialVersionUID = 1L;

	@Transient
	private List<UpkeepPickupNoticeLine> noticeLineList;

	@Override
	public String initTypeCode() {
		return "UP1";
	}

	@Override
	public NoticeLine createLine(OrderExcuteLineVo orderExcuteVo) {
		UpkeepPickupNoticeLine noticeLine = new UpkeepPickupNoticeLine();
		noticeLine.setOriginBizLineNo(orderExcuteVo.getBizOrderlineNo());
		noticeLine.setOriginBizNo(orderExcuteVo.getBizOrderNo());
		noticeLine.setItemCode(orderExcuteVo.getItemCode());
		noticeLine.setNoticeNo(this.getNoticeNo());
		noticeLine.setQuantity(orderExcuteVo.getQuantity());
		noticeLine.setSort(orderExcuteVo.getSort());
		noticeLine.setLotNo(orderExcuteVo.getLotNo());
		noticeLine.setSubLotIndex(orderExcuteVo.getSubLotIndex());
		return noticeLine;
	}

	@Override
	public List<? extends NoticeLine> getNoticeLines() {
		return this.noticeLineList;
	}

}
